package com.yaodian100.mall.timelimitsale;

import java.io.File;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.commons.lang.StringUtils;

import com.yaodian100.core.common.utils.ServerValue;

/**
 * 限时抢购
 * 
 * @author apple.chang
 * 
 */
public class TimeLimitSaleAction {

	private String date;
	private String fileName;
	private String mon;
	private String day;
	private String pass;
	private String pageTitle;
	private String pageDescription;
	private String pageKeywords;

	public String list() throws ParseException {
		pageTitle = ServerValue.getSeoProp().getProperty("tls.title");
		pageDescription = ServerValue.getSeoProp().getProperty("tls.description");
		pageKeywords = ServerValue.getSeoProp().getProperty("tls.keywords");

		DateFormat df = new SimpleDateFormat("yyyyMMdd");
		Date listDate;
		if (StringUtils.isNotBlank(date) && "tlsTaipei".equals(pass)) {
			listDate = df.parse(date);
		} else {
			listDate = new Date();
		}
		File file = new File(ServerValue.getFrontContentHtmlPath() + "COMMON" + File.separator + "TLS" + File.separator
				+ df.format(listDate) + ".html");
		if (!file.exists()) {
			listDate = new Date();
		}
		fileName = df.format(listDate);
		mon = Integer.parseInt(fileName.substring(4, 6)) + "";
		day = Integer.parseInt(fileName.substring(6, 8)) + "";
		return "list";
	}

	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	public String getFileName() {
		return fileName;
	}

	public String getMon() {
		return mon;
	}

	public String getDay() {
		return day;
	}

	public String getPass() {
		return pass;
	}

	public void setPass(String pass) {
		this.pass = pass;
	}

	public String getPageTitle() {
		return pageTitle;
	}

	public void setPageTitle(String pageTitle) {
		this.pageTitle = pageTitle;
	}

	public String getPageDescription() {
		return pageDescription;
	}

	public void setPageDescription(String pageDescription) {
		this.pageDescription = pageDescription;
	}

	public String getPageKeywords() {
		return pageKeywords;
	}

	public void setPageKeywords(String pageKeywords) {
		this.pageKeywords = pageKeywords;
	}

}